<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h:form id="userForm" enctype="multipart/form-data">
                <h1 class="title">Usuario</h1>
                <p:growl id="messages" showDetail="true" autoUpdate="true"  /> 
                <div class="row">
                    <div class="twelve columns"> 
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Pesquisar</h4></legend>
                            <p:panel id="userPanel" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix ">

                                <p:outputLabel value="Nome: " styleClass="grid_3"/>
                                <p:inputText styleClass="grid_20" value="#{managerSearchUser.searchUser.name}" />

                            </p:panel>

                        </fieldset>
                       
                        <br/>
                        <div class="buttonAction">
                            <p:commandButton value="Pesquisar" icon="ui-icon-search"
                                             update="@form, tableUser"
                                             actionListener="#{managerSearchUser.search()}"
                                             styleClass="ui-priority-primary" />
                            <p:button href="indexuser.xhtml" value="Cancelar"  icon="ui-icon-trash" />
                        </div >
                    </div>
                    <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Resultado</h4></legend>
                            <p:panel id="resultPanel" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix ">

                                <p:dataTable id="tableUser" var="u" value="#{managerSearchUser.users}" 
                                     styleClass="grid_24"
                                     rowIndexVar="rowid"
                                     rowKey="#{u.id}"
                                     rows="5" paginator="true"  
                                     paginatorPosition="bottom"
                                     emptyMessage="Nenhum registro">  
                            <f:facet name="header">
                               Usuário
                            </f:facet>
                            <p:column headerText="Nome" width="600">  
                                <h:outputText value="#{u.name}"/>
                            </p:column>  
                            <p:column headerText="Login">  
                                <h:outputText value="#{u.login}"/>
                            </p:column>
                           
                            <p:column headerText="Ação" width="75">
                                <p:button  style="width: 20px; height: 20px;" 
                                                  title="editar"
                                                  href="editUser.xhtml?userEdit=#{u.id}"
                                                  icon="ui-icon-pencil"/>
                                <p:button  style="width: 20px; height: 20px;" 
                                                   title="visualizar"
                                                   href="showUser.xhtml?userShow=#{u.id}"
                                                  icon="ui-icon-zoomin"/>
                                 <p:button  style="width: 20px; height: 20px;" 
                                                  title="Acesso"
                                                   href="acessUser.xhtml?userAcess=#{u.id}"
                                                  icon="ui-icon-locked"/>
                            </p:column>
                        </p:dataTable> 

                            </p:panel>

                        </fieldset>
                    
                </div>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
